//package com.example.score.config;
//
//import org.apache.rocketmq.client.producer.DefaultMQProducer;
//import org.apache.rocketmq.spring.core.RocketMQTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.ApplicationArguments;
//import org.springframework.boot.ApplicationRunner;
//import org.springframework.stereotype.Component;
//
//import lombok.extern.slf4j.Slf4j;
//
//@Slf4j
//@Component
//public class RocketMQHealthCheck implements ApplicationRunner {
//
//    @Value("${rocketmq.name-server}")
//    private String nameServer;
//
//    @Value("${rocketmq.producer.group}")
//    private String producerGroup;
//
//    @Autowired
//    private RocketMQTemplate rocketMQTemplate;
//
//    @Override
//    public void run(ApplicationArguments args) {
//        try {
//            DefaultMQProducer producer = rocketMQTemplate.getProducer();
//            log.info("RocketMQ 连接检查开始: nameServer={}, producerGroup={}", nameServer, producerGroup);
//
//            // 获取集群信息
//            producer.getDefaultMQProducerImpl()
//                   .getmQClientFactory()
//                   .getMQClientAPIImpl()
//                   .getTopicRouteInfoFromNameServer(RocketMQConfig.EXAM_DETAIL_TOPIC, 3000);
//
//            log.info("RocketMQ 连接成功: nameServer={}, producerGroup={}", nameServer, producerGroup);
//        } catch (Exception e) {
//            log.error("RocketMQ 连接失败: nameServer={}, producerGroup={}, error={}",
//                nameServer, producerGroup, e.getMessage(), e);
//        }
//    }
//}